package com.geek.statistics;

import com.geek.statistics.beans.MetricsCollector;
import com.geek.statistics.beans.RequestInfo;
import com.geek.statistics.dao.MetricsStorage;
import com.geek.statistics.dao.RedisMetricsStorage;
import com.geek.statistics.report.ConsoleReporter;
import com.geek.statistics.report.Reporter;

public class Client {
    public static void main(String[] args) {
        MetricsStorage storage = new RedisMetricsStorage();
        Reporter reporter = new ConsoleReporter(3, 3, storage);
        reporter.report();

        /*EmailReporter emailReporter = new EmailReporter(storage);
        emailReporter.addToAddress("wangzheng@xzg.com");
        emailReporter.startDailyReport();*/

        MetricsCollector collector = new MetricsCollector(storage);
        collector.recordRequest(new RequestInfo("register", 123, 10234));
        collector.recordRequest(new RequestInfo("register", 223, 11234));
        collector.recordRequest(new RequestInfo("register", 323, 12334));
        collector.recordRequest(new RequestInfo("login", 23, 12434));
        collector.recordRequest(new RequestInfo("login", 1223, 14234));

        /*try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
    }
}